import {
  getList,
} from '@/api/depart.js'

export default {
  namespaced: true,
  state: {
    selectedDepart: null,
    selectedDepartNew: null,
    list: [],
  },
  actions: {
    async getList ({
      state,
    }) {
      const { success, data } = await getList()
      let list = []
      if (success) {
        list = data.data
      }
      console.log('wojinlaizheli')
      console.log(list)
      state.list = list
      return list
    },
  },
  mutations: {
    setSelected (state, payload) {
      state.selectedDepart = payload
    },
    setSelectedNew (state, payload) {
      state.selectedDepartNew = payload
    },
  },
}
